﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using QLKTX1._0.DAO;
using QLKTX1._0.DTO;

namespace QLKTX1._0.GUI
{
    public partial class FrmConfig : Form
    {
        public FrmConfig()
        {
            InitializeComponent();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void FrmConfig_Load(object sender, EventArgs e)
        {
            dgrdotdk.DataSource = DotDangKyDAO.dsDotDangKy();
            dgrdotdk.Columns[0].HeaderText = "Mã Đợt";
            dgrdotdk.Columns[1].HeaderText = "Năm Học";
            // if (dgrdotdk.Columns[1].GetType() is NamHocDTO)
            //  {
            // dgrdotdk.Columns[1].CellType
            // }
            //Chinh do rong cua cot..............       
            //Cam chinh sua cot, chi doc.............
            dgrdotdk.Columns[0].ReadOnly = true;
            dgrdotdk.Columns[1].ReadOnly = true;
        }

        private DataTable ds(List<DotDangKyDTO> list)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("1"));
            dt.Columns.Add(new DataColumn("2"));
            dt.Columns.Add(new DataColumn("3"));
            dt.Columns.Add(new DataColumn("4"));
            dt.Columns.Add(new DataColumn("5"));

            foreach (DotDangKyDTO year in list)
            {
                dt.AcceptChanges();

                DataRow row =dt.NewRow();

                row[0] = year.MaDot;
                row[1] = year.NamHoc.TenNamHoc;
                row[2] = year.MaDot;
                row[3] = year.MaDot;

                dt.Rows.Add(row);

            }

            return dt;
        }
    }
    
}
    
